<?php
/**
 * 小说Dao
 */

class Dao_NovelChannelCategoryModel extends Dao_BaseModel {

    protected $_table = 'novel_channel_category';

    const NORMAL_STATUS = 1;
    const REDIS_KEYWORD = 'NOVEL_CATEGORY_KEY_';
    const EXTIME        = '86400';

    public function __construct ()
    {
        parent::__construct ();
    }

    /**
     * 获取小说章节列表.
     * @param $wheres
     * @return array|bool
     */
    public function getAllChannel ()
    {
        $where = [];
        $where[]  = array ( 'cate_status' , self::NORMAL_STATUS );
        $order  = array ( 'cate_order' => 'ASC' );
        $info = parent::getRows ( array ( 'cate_id' , 'cate_name' , 'cate_create_time' ) , $where , $order );
        return $info ? $info : false;
    }
    
    public function getChannelInfo( $id )
    {
        if( !$id ){
            return false;
        }
        $where = [];
        $where[]  = array ( 'cate_status' , self::NORMAL_STATUS );
        $where[]  = array ( 'cate_id' , $id );
        $info = parent::getOne ( array ( 'cate_id' , 'cate_name' , 'cate_create_time' ) , $where );
        return $info ? $info : false;
    }
    
}
